import {CHANGE_LONGIN_STATUS, UserTypes} from "./action";

export interface UserState {
    status: boolean;
    token: string;
    email: string;
    username: string
    password: string
}

const defaultState: UserState = {
    status: false,
    token: '',
    email: '',
    password: '',
    username: ''
}


export default function userReducer(state = defaultState, action: UserTypes) {
    switch (action.type) {
        case CHANGE_LONGIN_STATUS:
            return {
                ...state,
                ...action.payload
            };
        default:
            return state;
    }
}
